package com.handpay.zztong.hp.withdraw.model;

import com.handpay.framework.fastjson.FastJsonHelper;
import com.handpay.zztong.hp.base.activity.ZZTongActivity;
import com.handpay.zztong.hp.base.callback.BusinessEngineListener;
import com.handpay.zztong.hp.base.model.base.BaseModel;
import com.handpay.zztong.hp.config.HttpUrlConstant;
import com.handpay.zztong.hp.withdraw.bean.LowestWithDrawBean;

import java.util.Hashtable;

/**
 * @author sxshi on 2017/5/2.
 *         email:emotiona_xiaoshi@126.com
 *         describe:Describe the function  of the current class
 */

public class LowestWithDrawModel extends BaseModel {
    private BusinessEngineListener<LowestWithDrawBean> mBeanBusinessEngineListener;
    private ZZTongActivity mContext;

    public LowestWithDrawModel(ZZTongActivity mContext) {
        this.mContext = mContext;
    }

    /**
     * query lowests withdraw
     *
     * @param action                 request Action
     * @param paramers               request paramers
     * @param businessEngineListener call back listener
     */
    public void queryLowestWithdraw(String action, Hashtable<String, String> paramers, BusinessEngineListener<LowestWithDrawBean> businessEngineListener) {
        this.mBeanBusinessEngineListener = businessEngineListener;
        doPost(mContext, action, paramers);
    }

    @Override
    public boolean netResponse(String action, byte[] data) {
        if (super.netResponse(action, data)) return true;
         if (action.equals(HttpUrlConstant.Do_GetLowestWithdrawMoney)) {
            LowestWithDrawBean lowestWithDrawBean = new LowestWithDrawBean();
            if (data_type == DATA_TYPE.DATA_TYPE_JSON) {
                lowestWithDrawBean = FastJsonHelper.getObject(new String(data), LowestWithDrawBean.class);
            }
            if (mBeanBusinessEngineListener != null) mBeanBusinessEngineListener.callbackBusinessResponse(lowestWithDrawBean);
        }
        return false;
    }
}
